package com.uzai.console.web.user;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.user.wechatblacklist.WechatBlacklistPubIdDto;
import com.uzai.console.dto.user.wechatblacklist.WechatBlacklistPubQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.user.WechatBlacklistPubService;
import com.uzai.console.vo.user.wechatblacklist.WechatBlacklistPubInfoVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户管理|云黑名单|共享黑名单
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "全网黑名单",tags = "用户管理|云黑名单|全网黑名单")
@ApiSort(15)
@RestController
public class WechatBlacklistPubController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(WechatBlacklistPubController.class);

    @Autowired
    private WechatBlacklistPubService wechatBlacklistPubService;

    @ApiOperation(value = "分页查询全网黑名单列表", notes = "分页查询全网黑名单列表", response = WechatBlacklistPubInfoVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/wechatBlacklistPub/findWechatBlacklistPubList")
    public Object findWechatBlacklistPubList(@RequestBody WechatBlacklistPubQuery wechatBlacklistPubQuery){
        return wechatBlacklistPubService.findWechatBlacklistPubList(wechatBlacklistPubQuery);
    }

    @SystemLogType(model = SystemModelEnum.WechatBlacklistPub, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "加入白名单", notes = "加入白名单")
    @ApiOperationSupport(order = 2)
    @PostMapping("/wechatBlacklistPub/addWechatBlacklistPubWhite")
    public Object addWechatBlacklistPubWhite(@RequestBody WechatBlacklistPubIdDto wechatBlacklistPubIdDto){
        wechatBlacklistPubService.addWechatBlacklistPubWhite(wechatBlacklistPubIdDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.WechatBlacklistPub, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "取消白名单", notes = "取消白名单")
    @ApiOperationSupport(order = 3)
    @PostMapping("/wechatBlacklistPub/deleteWechatBlacklistPubWhite")
    public Object deleteWechatBlacklistPubWhite(@RequestBody WechatBlacklistPubIdDto wechatBlacklistPubIdDto){
        wechatBlacklistPubService.deleteWechatBlacklistPubWhite(wechatBlacklistPubIdDto);
        return true;
    }
}
